<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'contact.label', default: 'Contact')}"/>
    <title>修改客户信息</title>
    <style>
    .positionStyle .control-label{
        text-align: left;
    }
    .positionStyle1 .control-label{
        text-align: right;
        padding-top: 8px;
    }
    .text-left{
        text-align: left!important;
    }
    .text-right{
        text-align: right!important;
    }
    .form-controls{
        display: inline;
        width:90px;
        height: 34px;
        padding: 6px 12px;
        font-size: 14px;
        line-height: 1.42857143;
        color: #555;
        background-color: #fff;
        background-image: none;
        border: 1px solid #ccc;
        border-radius: 4px;
        -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
        box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
        -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
        -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
        transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
        border-color: #eaeaea !important;
    }
    .textMargin{
        margin-top: 8px;
    }
    </style>
</head>

<body>
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>PLS CINDATA</li>
                    <li>
                        <g:link controller="menu" action="index">CINDATA</g:link>
                    </li>
                    <li class="active">
                        <span>修改客户信息</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                修改客户信息
            </h2>
        </div>
    </div>
</div>


<g:if test="${flash.message}">
    <div class="message alert alert-info" role="status">${flash.message}</div>
</g:if>
<g:hasErrors bean="${ menu}">
    <ul class="errors" role="alert">
        <g:eachError bean="${ menu}" var="error">
            <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message
                    error="${error}"/></li>
        </g:eachError>
    </ul>
</g:hasErrors>


<div class="content animate-panel">
    <div class="row">
        <div class="hpanel hblue">
            <div class="panel-heading">
                修改客户信息
            </div>

            <div class="panel-body form-horizontal positionStyle">

                <div class="form-group">
                    <label class="control-label">2.客户资信状况</label>
                </div>
                <div class="form-group">
                    <label class="control-label">（一） 借款人、配偶及共同借款人的信用记录查询</label>
                </div>
                <form class="financialLoanForm">
                    <g:each in="${contactSurveyList}" var="contact" status="i">
                        <input type="hidden" value="${contact?.id}" name="contactId${i+1}">
                        <div class="form-group ">
                            <label class="col-md-2 control-label text-right">项目/被查询人:</label>
                            <label class="col-md-4 control-label" style="text-align: center">借款人${i+1}</label>
                            <g:if test="${contact?.maritalStatus== "已婚" || contact?.maritalStatus== "再婚"}">
                                <label class="col-md-6 control-label" style="text-align: center">配偶</label>
                            </g:if>

                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label is-required text-right">征信逾期记录:</label>
                            <div class="col-md-4">
                                <g:each in="${com.cindata.ContactSurvey.constrainedProperties.creditOverdueRecord.inList}">
                                    <div class="col-md-3 control-label">
                                        <g:radio name="creditOverdueRecord${i+1}" value="${it}" checked="${contact?.creditOverdueRecord == it}"/>${it}
                                    </div>
                                </g:each>
                            </div>
                            <g:if test="${contact?.maritalStatus== "已婚" ||  contact?.maritalStatus== "再婚"}">
                                <div class="col-md-4 col-md-offset-1">
                                    <g:each in="${com.cindata.ContactSurvey.constrainedProperties.spouseCreditOverdueRecord.inList}">
                                        <div class="col-md-3 control-label">
                                            <g:radio name="spouseCreditOverdueRecord${i+1}" value="${it}" checked="${contact?.spouseCreditOverdueRecord == it}"/>${it}
                                        </div>
                                    </g:each>
                                </div>
                            </g:if>

                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label is-required text-right">征信主要违约记录:</label>
                            <div class="col-md-4">
                                <g:each in="${com.cindata.ContactSurvey.constrainedProperties.creditDefaultingRecord.inList}">
                                    <div class="col-md-3 control-label">
                                        <g:radio name="creditDefaultingRecord${i+1}" value="${it}" checked="${contact?.creditDefaultingRecord == it}"/>${it}
                                    </div>
                                </g:each>
                            </div>
                            <g:if test="${ contact?.maritalStatus== "已婚" ||  contact?.maritalStatus== "再婚"}">
                                <div class="col-md-4 col-md-offset-1">
                                    <g:each in="${com.cindata.ContactSurvey.constrainedProperties.spouseCreditDefaultingRecord.inList}">
                                        <div class="col-md-3 control-label">
                                            <g:radio name="spouseCreditDefaultingRecord${i+1}" value="${it}" checked="${contact?.spouseCreditDefaultingRecord == it}"/>${it}
                                        </div>
                                    </g:each>
                                </div>
                            </g:if>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label is-required text-right">近半年征信查询次数:</label>
                            <div class="col-md-4">

                                <g:each in="${com.cindata.ContactSurvey.constrainedProperties.creditSearchingTimesInHalfYear.inList}">
                                    <div class="col-md-3 control-label">
                                        <g:radio name="creditSearchingTimesInHalfYear${i+1}" value="${it}" checked="${contact?.creditSearchingTimesInHalfYear == it}"/>${it}
                                    </div>
                                </g:each>
                            </div>
                            <g:if test="${ contact?.maritalStatus== "已婚" ||  contact?.maritalStatus== "再婚"}">
                                <div class="col-md-4 col-md-offset-1">
                                    <g:each in="${com.cindata.ContactSurvey.constrainedProperties.spouseCreditSearchingTimesInHalfYear.inList}">
                                        <div class="col-md-3 control-label">
                                            <g:radio name="spouseCreditSearchingTimesInHalfYear${i+1}" value="${it}" checked="${contact?.spouseCreditSearchingTimesInHalfYear == it}"/>${it}
                                        </div>
                                    </g:each>
                                </div>
                            </g:if>
                        </div>
                        <div class="form-group"><g:if test="${i < 1}"><hr style="border:0.5px dashed"></g:if></div>
                    </g:each>

                    <div class="form-group">
                        <div class="col-md-3 col-md-offset-6">
                            <g:submitButton class="btn btn-info financialLoanBtn" name="create" value="保存"/>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <div class="row" id="second">
        <div class="hpanel hgreen">
            <div class="panel-body positionStyle1">
                <div class="form-group">
                    <label class="control-label">（二） 借款人、配偶及共同借款人原有负债情况</label>
                </div>
                <div class="form-group">
                    <label class="control-label">金融机构原有贷款</label>
                </div>
                <form class="originalDebtForm">
                    <g:each in="${contactSurveyList}" var="contact" status="i">
                        <input type="hidden" value="${contact?.id}" name="contactId${i+1}">
                    <div class="row">
                        <div class="form-group">
                            <div class="control-label text-left" style="margin-left: 4%">
                                <label class="control-label">借款人${i+1}</label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">负债类型</label>
                            <div class="col-md-2" style="margin-top: 8px;" >
                                <input type="text" value="${contact?.debtType}" style="border: none" name="debtType${i+1}"/>
                            </div>
                            <label class="col-md-1 control-label">笔数:</label>
                            <div class="col-md-2">
                                <div class="input-group m-b">
                                    <g:textField class="form-control inputMargin" type="text" name="debtMount${i+1}"   value="${contact?.debtMount}" placeholder="请输入数字"/>
                                    <span class="input-group-addon">元</span>
                                </div>
                            </div>
                            <label class="col-md-1 control-label">结余金额：</label>
                            <div class="col-md-2">
                                <div class="input-group m-b">
                                    <g:textField class="form-control" type="text" name="loansBalance${i+1}"   value="${contact?.loansBalance}" placeholder="请输入数字"/>
                                    <span class="input-group-addon">元</span>
                                </div>
                            </div>
                        </div>

                        <div class="clearfix"></div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label">月均还款额:</label>
                            <div class="col-md-2">
                                <div class="input-group m-b">
                                    <g:textField class="form-control" type="text" name="repaymentMountPerMon${i+1}"   value="${contact?.repaymentMountPerMon}" placeholder="请输入数字"/>
                                    <span class="input-group-addon">元</span>
                                </div>
                            </div>
                            <label class="col-md-1 control-label">备注:</label>
                            <div class="col-md-3">
                                <textarea class="form-control" name="memo${i+1}" value="${contact?.memo}">${contact?.memo}</textarea>
                            </div>
                        </div>
                    </div>
                    </g:each>
                    <g:each in="${contactSurveyList}" var="contact" status="i">
                    <div class="form-group">
                        <div class="col-md-2 control-label">
                            <label class="control-label">借款人${i+1}:</label>
                        </div>
                        <div class="col-md-8" >
                            <label class="control-label">信用卡透支金额 <input type="text" class="form-controls" placeholder="请输入数字" name="overdraftAmount${i+1}" value="${contact?.overdraftAmount}"> 元，为他人债务担保余额合计 <input type="text" class="form-controls" placeholder="请输入数字" name="guaranteeForOthersAmount${i+1}" value="${contact?.guaranteeForOthersAmount}"> 元</label>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                    </g:each>
                    <div class="form-group">
                        <div class="col-md-3 col-md-offset-6">
                            <g:submitButton class="btn btn-info originalDebtBtn" name="create2" value="保存"/>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-body form-horizontal">
                <div class="panel-heading">
                    （三） 家庭成员收入能力检查记录
                </div>
                <g:form action="createClientCollateralPurchase">
                    <input type="hidden" name="editType" value="editClientCollateralPurchase">
                    <input type="hidden" name="reportId" value="${ contactSurveyReport?.id}">
                    <g:each in="${contactSurveyList}" var="contactSurvey" status="i">
                        <input type="hidden" value="${contactSurvey?.id}" name="contactId${i+1}">
                    <div class="row">
                        <div class="panel-heading">
                            借款人${i+1}
                        </div>
                        <div class="panel-heading">
                            (1)单位核查
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">单位名称:</label>
                            <div class="col-md-8">
                                <g:textField class="form-control" type="text" name="workUnitName${i+1}"  value="${contactSurvey?.workUnitName}" placeholder="请填写单位名称"/>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">单位地址:</label>
                            <div class="col-md-8">
                                <g:textField class="form-control" type="text" name="workUnitAddress${i+1}"   value="${contactSurvey?.workUnitAddress}" placeholder="请填写单位地址"/>
                            </div>
                        </div>

                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required">单位性质</label>
                            <div class="col-md-6">
                                <g:each in="${com.cindata.dictionary.OrganizationNatureDict.list()}">
                                    <div class="radio radio-info radio-inline">
                                        <g:radio name="workUnitNature${i+1}" value="${it?.id}" checked="${contactSurvey?.workUnitNature?.id == it?.id}" />
                                        <label>${it?.name}</label>
                                    </div>
                                </g:each>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">固定电话:</label>
                            <div class="col-md-3">
                                %{--<input type="text" class="form-controls" name="workUnitPhone1"> - <input type="text" class="form-controls" style="width: 200px" name="workUnitPhone2">--}%
                                <input type="text" class="form-controls" name="workUnitPhone${i+1}" value="${contactSurvey?.workUnitPhone}">
                            </div>
                            <label class="col-md-2 control-label is-required">号码验证渠道:</label>
                            <div class="col-md-3">
                                <g:textField class="form-control" type="text" name="numberCheckChannel${i+1}"   value="${contactSurvey?.numberCheckChannel}" placeholder="请填写号码验证 渠道"/>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">核查时间:</label>
                            <div class="col-md-3">
                                %{--<div class="input-daterange input-group p-r-n">--}%
                                    %{--<input type="text" class="form-control datepicker1" placeholder="请填写核查时间"--}%
                                           %{--value="${ contactSurvey?.workUnitCheckDate}" name="workUnitCheckDate${i+1}" style="text-align: left" />--}%
                                %{--</div>--}%
                                <div class="input-group date form_datetime">
                                    <span class="input-group-addon">
                                        <span class="fa fa-calendar"></span>
                                    </span>
                                    <input type="text" name="workUnitCheckDate${i+1}" id="workUnitCheckDate" placeholder="请填写核查时间"
                                           value="${contactSurvey?.workUnitCheckDate}" readonly class="form-control daily-b">
                                </div>

                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">核查提问：</label>
                            <div class="col-md-5">
                                <div class="radio radio-info radio-inline">
                                    <g:radio name="checkContent${i+1}" value="是否本单位职工" checked="${contactSurvey?.checkContent == '是否本单位职工'}"/>
                                    <label for="sex1">是否本单位职工</label>
                                </div>
                                <div class="radio radio-info radio-inline ">
                                    <g:radio name="checkContent${i+1}" value="职工个人情况是否吻合" checked="${contactSurvey?.checkContent == '职工个人情况是否吻合'}"/>
                                    <label for="sex2">职工个人情况是否吻合</label>
                                </div>
                                <div class="radio radio-info radio-inline ">
                                    <g:radio name="checkContent${i+1}" value="员工缴存情况是否与系统对应" checked="${contactSurvey?.checkContent == '员工缴存情况是否与系统对应'}"/>
                                    <label for="sex2">员工缴存情况是否与系统对应</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">接听人员:</label>
                            <div class="col-md-3">
                                <g:textField class="form-control" type="text" name="checkReceiver${i+1}"   value="${contactSurvey?.checkReceiver}" placeholder="请输入接听人员姓名"/>
                            </div>
                            <label class="col-md-2 control-label is-required">身份:</label>
                            <div class="col-md-5">
                                <div class="radio radio-info radio-inline">
                                    <g:radio name="checkReceiverIdentity${i+1}" value="人事/劳资" checked="${contactSurvey?.checkReceiverIdentity == '人事/劳资'}"/>
                                    <label for="sex1">人事/劳资</label>
                                </div>
                                <div class="radio radio-info radio-inline ">
                                    <g:radio name="checkReceiverIdentity${i+1}" value="综合办公" checked="${contactSurvey?.checkReceiverIdentity == '综合办公'}"/>
                                    <label for="sex2">综合办公</label>
                                </div>
                                <div class="radio radio-info radio-inline ">
                                    <g:radio name="checkReceiverIdentity${i+1}" value="其他" checked="${contactSurvey?.checkReceiverIdentity == '其他'}"/>
                                    <label for="sex2">其他</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">单位人员答复情况:</label>
                            <div class="col-md-6">
                                <div class="radio radio-info radio-inline">
                                    %{--<input type="radio" name="answeredSituation${i+1}" value="核实无误" checked="${contactSurvey?.answeredSituation == '核实无误'}">--}%
                                    <g:radio value="核实无误" name="answeredSituation${i+1}" checked="${contactSurvey?.answeredSituation == '核实无误'}"/>
                                    <label>核实无误</label>
                                </div>
                                <div class="radio radio-info radio-inline ">
                                    <g:radio value="异常" name="answeredSituation${i+1}" checked="${contactSurvey?.answeredSituation == '异常'}"/>
                                    %{--<input type="radio" name="answeredSituation${i+1}" value="异常" id="abnormal1" checked="${contactSurvey?.answeredSituation == '异常'}">--}%
                                    <label>异常（请写明情况）</label>
                                </div>
                                <input type="text" class="form-controls" name="abnormalMeno${i+1}" id="abnormalMeno1" value="${contactSurvey?.abnormalMeno}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label">工作单位实地核实情况(可选填):</label>
                            <div class="col-md-3">
                                <g:textField class="form-control" type="text" name="actuallyCheckSituation${i+1}"   value="${contactSurvey?.actuallyCheckSituation}" placeholder="工作单位实地核实情况"/>
                            </div>
                        </div>


                        <div class="panel-heading">
                            (2)公积金缴存情况
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">起始月份：</label>
                            <div class="col-md-2">
                                %{--<div class="input-daterange input-group p-r-n">--}%
                                    %{--<input type="text" class="form-control datepicker1" placeholder="请填写起始月份"--}%
                                           %{--value="${ contactSurvey?.fundDepositStartDate}" name="fundDepositStartDate${i+1}" style="text-align: left" />--}%
                                %{--</div>--}%
                                <div class="input-group date form_datetime">
                                    <span class="input-group-addon">
                                        <span class="fa fa-calendar"></span>
                                    </span>
                                    <input type="text" name="fundDepositStartDate${i+1}" placeholder="请填写起始月份"
                                           value="${contactSurvey?.fundDepositStartDate}" readonly class="form-control daily-b">
                                </div>
                            </div>
                            <label class="col-md-1 control-label is-required">截止月份:</label>
                            <div class="col-md-2">
                                %{--<div class="input-daterange input-group p-r-n">--}%
                                    %{--<input type="text" class="form-control datepicker1" placeholder="请填写截止月份"--}%
                                           %{--value="${ contactSurvey?.fundDepositEndDate}" name="fundDepositEndDate${i+1}" style="text-align: left" />--}%
                                %{--</div>--}%
                                <div class="input-group date form_datetime">
                                    <span class="input-group-addon">
                                        <span class="fa fa-calendar"></span>
                                    </span>
                                    <input type="text" name="fundDepositEndDate${i+1}" placeholder="请填写截止月份"
                                           value="${contactSurvey?.fundDepositEndDate}" readonly class="form-control daily-b">
                                </div>
                            </div>
                            <label class="col-md-1 control-label is-required" style="padding-right: 0;padding-left: 0;">连续缴存期数：</label>
                            <div class="col-md-2">
                                <div class="input-group m-b">
                                    <g:textField class="form-control" type="text" name="fundDepositDuration${i+1}"   value="${contactSurvey?.fundDepositDuration}" placeholder="数字"/>
                                    <span class="input-group-addon">期</span>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label is-required">月缴额：</label>
                            <div class="col-md-2">
                                <div class="input-group m-b">
                                    <g:textField class="form-control" type="text" name="fundDepositAmountPerMon${i+1}"   value="${ contactSurvey?.fundDepositAmountPerMon}" placeholder="请输入数字"/>
                                    <span class="input-group-addon">元</span>
                                </div>
                            </div>
                            <label class="col-md-1 control-label is-required">缴存比例:</label>
                            <div class="col-md-2">
                                <div class="input-group m-b">
                                    <g:textField class="form-control" type="text" name="fundDepositRatio${i+1}"   value="${contactSurvey?.fundDepositRatio}" placeholder="请输入数字"/>
                                    <span class="input-group-addon">%</span>
                                </div>
                            </div>
                            <label class="col-md-1 control-label is-required">月缴存基数：</label>
                            <div class="col-md-2">
                                <div class="input-group m-b">
                                    <g:textField class="form-control" type="text" name="fundDepositBaseAmount${i+1}"   value="${contactSurvey?.fundDepositBaseAmount}" placeholder="数字"/>
                                    <span class="input-group-addon">元</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required">公积金开户行:</label>
                            <div class="col-md-3">
                                <g:textField class="form-control" type="text" name="fundOpenedBank${i+1}"   value="${contactSurvey?.fundOpenedBank}" placeholder="请输入公积金开户行"/>
                            </div>
                            <label class="col-md-2 control-label is-required">公积金余额:</label>
                            <div class="col-md-3">
                                <div class="input-group m-b">
                                    <g:textField class="form-control" type="" name="fundBalance${i+1}" id="fundBalance"  value="${contactSurvey?.fundBalance}" placeholder="数字"/>
                                    <span class="input-group-addon">元</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group ">
                            <label class="col-md-2 control-label is-required">公积金缴存账号:</label>
                            <div class="col-md-3">
                                <g:textField class="form-control" type="text" name="fundAccount${i+1}"  id="fundAccount" value="${contactSurvey?.fundAccount}" placeholder="请输入公积金缴存账号"/>
                            </div>
                        </div>
                    </div>
                    </g:each>

                        <div class="row">
                            <strong>注：对外企、民企性质的单位职工，必须电话核实借款人的工作情况</strong>
                            <div>
                                根据上表核定:
                                <g:each in="${contactSurveyList}" var="contactSurvey" status="i">
                                <div class="form-group ">
                                    <label class="col-md-2 control-label is-required">认定借款人1月均总收入:</label>
                                    <div class="col-md-3">
                                        <div class="input-group m-b">
                                            <g:textField class="form-control" type="" name="monthlyTotalIncome${i+1}"   value="${contactSurvey?.monthlyTotalIncome}" placeholder="请输入数字"/>
                                            <span class="input-group-addon">元</span>
                                        </div>
                                    </div>
                                </div>

                                </g:each>
                            </div>
                            <div>
                                综上核定：
                                <div class="form-group ">
                                    <label class="col-md-2 control-label is-required">借款人、配偶及共同借款人合计税后收入月均:</label>
                                    <div class="col-md-3">
                                        <div class="input-group m-b">
                                            <g:textField class="form-control" type="" name="coOwnersMonTotalIncome"   value="${contactSurveyReport?.coOwnersMonTotalIncome}" placeholder="请输入数字"/>
                                            <span class="input-group-addon">元</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    <div class="form-group">
                        <div class="col-md-3 col-md-offset-6">
                            <g:submitButton class="btn btn-info" name="create3" value="下一步"/>
                            <button type="button" class="btn cancelButton" style="margin-left: 20px;">取消</button>
                        </div>
                    </div>
                </g:form>
            </div>
        </div>
    </div>



</div>
<g:javascript>
    $(function () {

        $(".financialLoanBtn").click(function () {
            $.ajax({
                url: "/contact/financialLoanSave",
                type: "POST",
                data: $(".financialLoanForm").serialize(),
                success: function(result){
                    if(result.status=="success"){
                        swal("修改成功", "", "success");
                    }else{
                        swal("修改失败", "", "fail");
                    }
                }
            });
        })
        $(".originalDebtBtn").click(function () {
            $.ajax({
                url: "/contact/originalDebtSave",
                type: "POST",
                data: $(".originalDebtForm").serialize(),
                success: function(result){
                    if(result.status=="success"){
                        swal("修改成功", "", "success");
                    }else{
                        swal("修改失败", "", "fail");
                    }
                }
            });
        })
    });
</g:javascript>
</body>
</html>
